package com.zycfc.zsf.boot.validation.validator;

import com.zycfc.zsf.boot.validation.annotation.*;
import java.util.regex.*;
import javax.validation.*;
import java.lang.annotation.*;

public class PhoneValidator implements ConstraintValidator<Phone, String>
{
    private static final Pattern MOBILE_REGEX;
    
    public void initialize(final Phone constraintAnnotation) {
    }
    
    public boolean isValid(final String value, final ConstraintValidatorContext context) {
        return null == value || PhoneValidator.MOBILE_REGEX.matcher(value).find();
    }
    
    static {
        MOBILE_REGEX = Pattern.compile("^((17[0-9])|(14[0-9])|(13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$");
    }
}
